package com.six.work.controller;

import com.six.work.entity.Post;
import com.six.work.services.PostServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("post")
public class PostController {
    @Autowired
    private PostServices postServices;

    @GetMapping("/list")
    public List<Post> findAllPost(){
        List<Post> list = postServices.findAllPost();
        return list;
    }

    @GetMapping("/list1")
    public List<Post> findPostByAppId(Integer applicant_id){
        List<Post> list = postServices.findPostByAppId(applicant_id);
        return list;
    }

    @GetMapping("/list2")
    public List<Post> findPostItem(Integer resume_post_id){
        List<Post> list = postServices.findPostItem(resume_post_id);
        return list;
    }

    //今日新增
    @GetMapping("/today")
    public Integer findTodayCom(){
        return postServices.FindTodayCom();
    }

    //本月新增
    @GetMapping("/month")
    public Integer findMonthCom(){
        return postServices.FindMonthCom();
    }

    //插入数据到post表 求职者对公司投递简历
    @PostMapping("/add")
    public Integer insertPost (@RequestBody Post post) {
        return postServices.insertPost(post);
    }

    //企业查看简历以后，修改状态为已查看
    @GetMapping("/update")
    public String updatePostState(Integer resume_post_id) {
        return postServices.updatePostState(resume_post_id);
    }

    //Pass
    @GetMapping("/reject")
    public String Reject(Integer resume_post_id) {
        return postServices.Reject(resume_post_id);
    }

    //接收
    @GetMapping("/received")
    public String Received(Integer resume_post_id) {
        return postServices.Received(resume_post_id);
    }

    //后台简历
    @GetMapping("/list3")
    public  List<Post> findResume() {
        return postServices.findResume();
    }
}
